<%@ page language="java" contentType="text/html; charset=UTF-8"
    pageEncoding="UTF-8"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>密码修改</title>
<%@ include file="../../common/importLib.jsp" %>
<script type="text/javascript">
	//var mrjyHtml5Url = "http://" + window.location.host.split(":")[0] + "/";
	$(function(){
		changePassword("passwordSrc","密码",true);		
		$("#passwordSrc").formValidator({onShow: "请输入原密码",onFocus: "请输入原密码", onCorrect: "原密码输入正确"})
		.inputValidator({min:6,max:16,empty:{leftEmpty:false,rightEmpty:false,emptyError:"原密码两边不能输入空格"},onError:"原密码由6~16个字符组成"})
		.regexValidator({regExp:"notempty",dataType:"enum",onError:"原密码非空"})
        .ajaxValidator({type: "get",dataType:"json",url: "../userInfo/passwordValidate.do",
        success: function (data){if(data=="ok"){return true;}else{return false;}},
        error:function(){alert("服务器连接错误，请重试...");}, onError:"原密码不正确，请重新输入！",onWait:"正在校验，请稍候..."});
		baseFormValidator("passwordNew","密码",6,16,"username");
		$("#repassword").formValidator({onShow:"请输入确认密码",onFocus:"确认密码由6~16个字母和数字混合组成",onCorrect:"确认密码输入正确！"})
		.inputValidator({min:6,max:16,empty:{leftEmpty:false,rightEmpty:false,emptyError:"确认密码两边不能输入空格"},onError:"确认密码由6~16个字母和数字混合组成"})
		.regexValidator({regExp:"username",dataType:"enum",onError:"确认密码由字母和数字混合组成"})
		.compareValidator({desID:"passwordNew",operateor:"=",onError:"两次密码不一致,请重输"});
		
		 
	});
	function changePassword(focusId,messagerFlag,loadFirstPageFlag){
		formSubmitOnce = true; //每次打开窗口formSubmitOnce都重新设为true
		$("#" + focusId).focus();  //光标定位			
		var addForm = $('#change_password');	
		$.formValidator.initConfig({
			formID : addForm.attr("id"),
			submitOnce:true,		
			onSuccess : function() {		
				if(formSubmitOnce==true){
					formSubmitOnce = false;
					$.post(addForm.attr("action"),addForm.serialize(),
						function(data){
							if(data=="ok"){						
								/* $.messager.alert("密码修改成功",messagerFlag + "密码修改成功！",'info'); */  //提示添加信息成功	
								$.get(getTimeURL("/mrjy/common/util/logout.do"),function(data){                		
									if(data=="ok"){
										parent.window.location = mrjyHtml5Url + "index.html";
									}
								});
							}
						},"json");				
					return false; 
				}
			}
		});	
	}
</script>
</head>
<body>
		<form id="change_password" action="../userInfo/updatePassword.do" method="post">
			<table  style="margin-top: 40px;margin-left: 30px;" class="mrjy_tb_1">
				<tbody>
					<tr>
						<td  class="mrjy_td_2">原密码：</td>
						<td ><input type="password" id="passwordSrc" name="passwordSrc" /></td>
						<td ><div id="passwordSrcTip" style="width:250px;"></div></td>
					</tr>
					<tr>
						<td class="mrjy_td_2">新密码：</td>
						<td><input type="password" id="passwordNew" name="passwordNew"/></td>
						<td><div id="passwordNewTip" style="width:250px"></div></td>
					</tr>
					<tr>
						<td class="mrjy_td_2">确认密码：</td>
						<td><input type="password" id="repassword"/></td>
						<td><div id="repasswordTip" style="width:250px"></div></td>
					</tr>										
					<tr>
						<td colspan="3" style="text-align: center">					
							<a class="easyui-linkbutton" iconCls="icon-ok" onclick="$('#change_password').submit();">修改</a>
							<a class="easyui-linkbutton" iconCls="icon-undo" onclick="document.getElementById('change_password').reset()">重置</a>
						</td>
					</tr>
				</tbody>
			</table>
		</form>

</body>
</html>